# rgba2rgb.py
# Description: Convert RGBA images to RGB images

import cv2
import os

img_folder = 'D:/PythonProjects/Datasets/CRN-Dataset-Pro/images0/val'
cvt_folder = 'D:/PythonProjects/Datasets/CRN-Dataset-Pro/images/val'

img_files = os.listdir(img_folder)

for img_file in img_files:
    img_path = os.path.join(img_folder, img_file)
    
    im = cv2.imread(img_path)
    rgb_im = cv2.cvtColor(im, cv2.COLOR_RGBA2RGB)

    cv2.imwrite(os.path.join(cvt_folder, img_file), rgb_im)
